package command;/**
 * @author XuXiaoK
 * @create 2020-01-21 18:55
 */

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import org.apache.http.impl.client.CloseableHttpClient;



/**
 * @Author XiaoKe
 * @Date 2020/1/21 18:55
 * @Description TODO
 */
public class MyCommand extends HystrixCommand<String> {
    int index;
    CloseableHttpClient httpClient;

    @Override
    protected String getFallback() {
        System.out.println("执行HelloCommand回退方法");
        return "error";
    }

    public MyCommand(int index) {

        super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")));

        this.index = index;
    }


    @Override
    protected String run() throws Exception {
        Thread.sleep(500);
        System.out.println("执行方法+" + index);
        return "";
    }
}
